from django.urls import re_path
from rest_framework.routers import DefaultRouter

from meiduo_admin.views import users, statistical, skus, permissions

urlpatterns = [
    #管理员登录
    re_path(r'^authorizations/$', users.AdminAuthorizeView.as_view()),
    #数据统计
    re_path(r'^statistical/day_active/$',statistical.UserDayActiveView.as_view()),
    re_path(r'^statistical/day_orders/$', statistical.UserDayOrdersView.as_view()),
    re_path(r'^statistical/month_increment/$',statistical.UserMonthCountView.as_view()),
    #普通用户管理
    re_path(r'^users/$',users.UserInfoView.as_view()),

    # #SKU图片管理
    # re_path(r'^skus/images$',skus.SKUImageViewSet.as_view({
    #     'get':'list',
    #     'post':'create'
    # })),
    # re_path(r'^skus/images/(?P<pk>\d+)$',skus.SKUImageViewSet.as_view({
    #     'get':'retrieve',
    #     'put':'update',
    #     'delete':'destory'
    # })),

    #图片管理
    re_path(r'^skus/simple/$',skus.SKUSimpleView.as_view()),

    #权限内容类型
    re_path(r'^permission/content_types/$',permissions.PermissionViewSet.as_view({
        'get':'content_types'
    })),
    #用户组管理
    re_path(r'^permission/simple/$',permissions.GroupViewSet.as_view({
        'get':'simple'
    })),
    #管理员管理
    re_path(r'^permission/groups/simple/$',permissions.AdminViewSet.as_view({
        'get':'simple'
    })),




]

#SKU图片管理
router = DefaultRouter()
router.register('skus/images', skus.SKUImageViewSet, basename='images')
urlpatterns += router.urls

#权限管理
router = DefaultRouter()
router.register('permission/perms',permissions.PermissionViewSet,basename='perms')
urlpatterns += router.urls

#用户组管理
router = DefaultRouter()
router.register('permission/groups',permissions.GroupViewSet,basename='groups')
urlpatterns += router.urls

#管理员管理
router = DefaultRouter()
router.register('permission/admins',permissions.AdminViewSet,basename='admins')
urlpatterns += router.urls